﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IIControls.IAControl
{
    /// <summary>
    /// 控制设备
    /// </summary>
    public class ControlType
    {
        /// <summary>
        /// ID
        /// </summary>
        public int ID
        {
            get;
            set;
        }
        public string Number
        {
            get;
            set;
        }
        public string Name
        {
            get;
            set;
        }

        public string State
        {
            get;
            set;
        }

        public DateTime CreateTime
        {
            get;
            set;
        }

        public int ControlDeviceID
        {
            get;
            set;
        }
        //[Required(ErrorMessage = "'设备类型'应为必须值")]
        public int DeviceType
        {
            get;
            set;
        }

        public int Type
        {
            get;
            set;
        }

        public string GPRSNumber
        {
            get;
            set;
        }

        //条田ID
        public int LandID
        {
            get;
            set;
        }

        public string CoorNumber
        {
            get;
            set;
        }

        private double angle=0;
        /// <summary>
        /// 角度
        /// </summary>
        public double Angle
        {

            get { return angle; }
            set { angle = value; }
        }
        private double height = 0;
        /// <summary>
        /// 高度
        /// </summary>
        public double Height
        {
            get { return height; }
            set { height = value; }
        }
        private double width=0;
        /// <summary>
        /// 宽度
        /// </summary>
        public double Width
        {
            get { return width; }
            set { width = value; }
        }
        private double left = 0;
        /// <summary>
        /// 距离左边的距离
        /// </summary>
        public double Left
        {
            get { return left; }
            set { left = value; }
        }
        private double top = 0;
        /// <summary>
        /// 距离顶部的距离
        /// </summary>
        public double Top
        {
            get { return top; }
            set { top = value; }
        }
        private int zindex = 0;
        /// <summary>
        /// Z次序
        /// </summary>
        public int ZIndex
        {
            get { return zindex; }
            set { zindex = value; }
        }
        private string assembly = null;
        public string Assembly
        {
            get
            {
                if (assembly == null)
                {
                    assembly = "IIControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                }
                return assembly;
            }
            set{assembly = value;}
        }
        private string namespace1 = null;
        public string NameSpace
        {
            get
            {
                if (namespace1 == null)
                {
                    namespace1 = "IIControls.IAControl";
                }
                return namespace1;
            }
            set { namespace1 = value; }
        }
        private string classname =null;
        public string ClassName
        {
            get
            {
                if (classname == null)
                { 
                    switch(DeviceType)
                    {
                        case 1:
                            classname = "valve";
                            break;
                        case 4:
                            classname = "PumpControl";
                            break;
                        default:
                            classname = "valve";
                            break;
                    }
                }
                return classname;
            }

            set { classname = value; }
        }

        private int flag=0;
        /// <summary>
        /// 操作标志【增加为1，更新为2，删除为3】
        /// </summary>
        public int Flag
        {
            get 
            {
                if (flag == 0)
                    flag = 2;
                return flag; 
            }
            set { flag = value; }
        }
    }
}
